/**
 * chenuu.com
 * 
 * @author  zhaoxu.com@gmail.com
 * @created 2012-11-9
 */
package com.chenuu.common.utils;

import java.util.Map;

/**
 *
 */
public class MapUtil {

	public static long getLong(Map<String, Object> map, String name) {
		Object val = map.get(name);
		long ret = -1;
		if (val != null) {
			if (val instanceof Number) {
				ret = ((Number) val).longValue();
			} else if (val instanceof String) {
				ret = Long.parseLong((String) val, 16);
			}
		}
		return ret;
	}
	
	public static boolean getBoolean(Map<String, Object> map, String name) {
        Object val = map.get(name);
        if (val != null && val instanceof Boolean) {
            return ((Boolean) val).booleanValue();
        } else {
            return false;
        }
    }

}
